﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using SMSSnew.DATA.CLASSES;


namespace SMSSnew.UI.vicePrincipal.timetable.dataEntry
{
    public partial class vicePrinTeacherAllocation : System.Web.UI.Page
    {
        string msg;
        static int slots = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                teacherCLZ objTeacher = new teacherCLZ();
                subjectCLZ objSubject = new subjectCLZ();
               


                DataTable dt1, dt2;

                dt1 = objTeacher.loadAllTeachers();
                dt2 = objSubject.loadAllSubjectNames();

                if (dt1.Rows.Count != 0)
                {
                    for (int i = 0; i < dt1.Rows.Count; i++)
                    {
                        string teacherID = dt1.Rows[i][0].ToString();
                        string teacherName = dt1.Rows[i][1].ToString();
                        string teacher = teacherID + ' ' + ':' + ' ' + teacherName;
                        cboTeacher.Items.Insert(i, teacher);
                    }
                }

                if (dt2.Rows.Count != 0)
                {
                    int K = 0;
                    for (int i = 0; i < dt2.Rows.Count; i++)
                    {
                        string subjectName = dt2.Rows[i][0].ToString();
                        if (subjectName.Equals("Extra"))
                            continue;
                        if (subjectName.Equals("Library"))
                            continue;


                        cbo_SubjectName.Items.Insert(K, subjectName);
                        ++K;
                    }
                }
            }
        }

        protected void cboSubjectName_SelectedIndexChanged(object sender, EventArgs e)
        {
            string subjectName = cbo_SubjectName.SelectedValue;
            subjectCLZ objSubject = new subjectCLZ(subjectName);
            int numberOfSubTypes;
            cbo_SubjectType.Items.Clear();

            numberOfSubTypes = objSubject.noOfSubTypes(subjectName);

            if (numberOfSubTypes > 1)
            {
                cbo_SubjectType.Enabled = true;
                DataTable setOfSubTypes = objSubject.getSubjectSubTypes(subjectName);

                for (int i = 0; i < numberOfSubTypes; i++)
                {
                    string subType = setOfSubTypes.Rows[i][0].ToString();
                    cbo_SubjectType.Items.Add(subType);
                }
            }
            else
            {
                cbo_SubjectType.Enabled = false;
            }
            clearSelectedStatus();
        }

        protected void cboTeacher_SelectedIndexChanged(object sender, EventArgs e)
        {
            clearSelectedStatus();
        }

        //method to active classes of grade 6
        protected void but_6_Click(object sender, EventArgs e)
        {
            string grade = but_6.Text;
            classCLZ obj = new classCLZ(grade);
            

            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox1, CheckBox2, CheckBox3, CheckBox4, CheckBox5, CheckBox6, CheckBox7, CheckBox8, CheckBox9, CheckBox10);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;

        }

        //method to active classes of grade 7
        protected void but_7_Click(object sender, EventArgs e)
        {
            string grade = but_7.Text;
            classCLZ obj = new classCLZ(grade);
            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox11, CheckBox12, CheckBox13, CheckBox14, CheckBox15, CheckBox16, CheckBox17, CheckBox18, CheckBox19, CheckBox20);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;


        }

        //method to active classes of grade 8
        protected void but_8_Click(object sender, EventArgs e)
        {
            string grade = but_8.Text;
            classCLZ obj = new classCLZ(grade);
            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox21, CheckBox22, CheckBox23, CheckBox24, CheckBox25, CheckBox26, CheckBox27, CheckBox28, CheckBox29, CheckBox30);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;

        }

        //method to active classes of grade 9
        protected void but_9_Click(object sender, EventArgs e)
        {
            string grade = but_9.Text;
            classCLZ obj = new classCLZ(grade);
            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox31, CheckBox32, CheckBox33, CheckBox34, CheckBox35, CheckBox36, CheckBox37, CheckBox38, CheckBox39, CheckBox40);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;


        }

        //method to active classes of grade 10
        protected void but_10_Click(object sender, EventArgs e)
        {
            string grade = but_10.Text;
            classCLZ obj = new classCLZ(grade);
            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox41, CheckBox42, CheckBox43, CheckBox44, CheckBox45, CheckBox46, CheckBox47, CheckBox48, CheckBox49, CheckBox50);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;

        }

        //method to active classes of grade 11
        protected void but_11_Click(object sender, EventArgs e)
        {
            string grade = but_11.Text;
            classCLZ obj = new classCLZ(grade);
            int noOfClasses = obj.getNoOfClasses(grade);

            CheckBox[] classesList = new CheckBox[10];
            classesList = classes(CheckBox51, CheckBox52, CheckBox53, CheckBox54, CheckBox55, CheckBox56, CheckBox57, CheckBox58, CheckBox59, CheckBox60);

            for (int i = 0; i < noOfClasses; i++)
                classesList[i].Enabled = true;


        }

        //..............method to add grade buttons in to an array..........................
        public Button[] gradeIDs(Button a, Button b, Button c, Button d, Button e, Button f)
        {
            Button[] gradeIDs = new Button[10];
            gradeIDs[0] = a;
            gradeIDs[1] = b;
            gradeIDs[2] = c;
            gradeIDs[3] = d;
            gradeIDs[4] = e;
            gradeIDs[5] = f;


            return gradeIDs;

        }

        //.............methods to add classID labels to an array....................................
        public Label[] classIDs(Label a, Label b, Label c, Label d, Label e, Label f, Label g, Label h, Label i, Label j)
        {
            Label[] classIDs = new Label[10];
            classIDs[0] = a;
            classIDs[1] = b;
            classIDs[2] = c;
            classIDs[3] = d;
            classIDs[4] = e;
            classIDs[5] = f;
            classIDs[6] = g;
            classIDs[7] = h;
            classIDs[8] = i;
            classIDs[9] = j;

            return classIDs;

        }

        //........................method to assign set of checkboxes in to an array...............................
        public static CheckBox[] classes(CheckBox a, CheckBox b, CheckBox c, CheckBox d, CheckBox e, CheckBox f, CheckBox g, CheckBox h, CheckBox i, CheckBox j)
        {
            CheckBox[] li = new CheckBox[10];
            li[0] = a;
            li[1] = b;
            li[2] = c;
            li[3] = d;
            li[4] = e;
            li[5] = f;
            li[6] = g;
            li[7] = h;
            li[8] = i;
            li[9] = j;

            return li;
        }

        //method to check the situation whether it exceeds 40 or already assigned
        protected string checkAllocationCondition(subjectSubTypesCLZ subObj, classCLZ classObj, teacherCLZ teacherObj, string teacher_id)
        {
            int totalSlots = teacherObj.takeTotalSlots(teacher_id);
                        
            if (totalSlots >= 40)
            {
                msg = "alert('Already allocated 40 periods for selected teacher');";
            }
            else if (classObj.checkForSubjectAllocationConflict(subObj) == true)
            {
                string claz = classObj.class_id;
                string m1 = "alert('Teacher is already assigned for a selected subject in ";
                string m2 = " class');";
                msg = m1 + claz + m2;
            }

            return msg;

        }

        //method to allocate teacher for particular subjec   & class
        protected string allocation(subjectSubTypesCLZ subObj, classCLZ classObj, teacherCLZ teacherObj, string teacher_id)
        {
            teacherObj.allocateTeachersForSubjects(subObj, classObj);
            msg = "alert('Successfully allocated.');";

            return msg;

        }

        //method to pass subject,class,teacher_id to checkAllocationCondition
        protected string setTocheckAllocationCondition(string class_id)
        {
            string subjectTypeId, teacher_id, subjectName, subjectSubTypeName, msg;

            string getTeacher = cboTeacher.SelectedValue;
            string[] teacherDetails = getTeacher.Split(':');
            teacher_id = teacherDetails[0];


            subjectName = cbo_SubjectName.SelectedValue;

            subjectSubTypesCLZ subObj = new subjectSubTypesCLZ();
            subObj.setSubjectName(subjectName);

            if (subObj.noOfSubTypes(subjectName) > 1)
                subjectSubTypeName = cbo_SubjectType.SelectedValue;
            else
                subjectSubTypeName = subjectName;

            classCLZ classObj = new classCLZ();
            teacherCLZ teacherObj = new teacherCLZ();
            teacherObj.setTeacherID(teacher_id);

            subjectTypeId = subObj.getSubTypeID(subjectName, subjectSubTypeName);
            subObj.setSubjectTypeID(subjectTypeId);

            classObj.setClassID(class_id);
            msg = checkAllocationCondition(subObj, classObj, teacherObj, teacher_id);

            return msg;
        }



        protected void clearSelectedStatus()
        {
            int k;
            CheckBox[] grade6Classes = new CheckBox[10];
            grade6Classes = classes(CheckBox1, CheckBox2, CheckBox3, CheckBox4, CheckBox5, CheckBox6, CheckBox7, CheckBox8, CheckBox9, CheckBox10);
            CheckBox[] grade7Classes = new CheckBox[10];
            grade7Classes = classes(CheckBox11, CheckBox12, CheckBox13, CheckBox14, CheckBox15, CheckBox16, CheckBox17, CheckBox18, CheckBox19, CheckBox20);
            CheckBox[] grade8Classes = new CheckBox[10];
            grade8Classes = classes(CheckBox21, CheckBox22, CheckBox23, CheckBox24, CheckBox25, CheckBox26, CheckBox27, CheckBox28, CheckBox29, CheckBox30);
            CheckBox[] grade9Classes = new CheckBox[10];
            grade9Classes = classes(CheckBox31, CheckBox32, CheckBox33, CheckBox34, CheckBox35, CheckBox36, CheckBox37, CheckBox38, CheckBox39, CheckBox40);
            CheckBox[] grade10Classes = new CheckBox[10];
            grade10Classes = classes(CheckBox41, CheckBox42, CheckBox43, CheckBox44, CheckBox45, CheckBox46, CheckBox47, CheckBox48, CheckBox49, CheckBox50);
            CheckBox[] grade11Classes = new CheckBox[10];
            grade11Classes = classes(CheckBox51, CheckBox52, CheckBox53, CheckBox54, CheckBox55, CheckBox56, CheckBox57, CheckBox58, CheckBox59, CheckBox60);


            for (k = 0; k < grade6Classes.Length; k++)
            {
                if (grade6Classes[k].Checked == true)
                    grade6Classes[k].Checked = false;
                if (grade6Classes[k].Enabled == true)
                    grade6Classes[k].Enabled = false;

            }

            for (k = 0; k < grade7Classes.Length; k++)
            {
                if (grade7Classes[k].Checked == true)
                    grade7Classes[k].Checked = false;
                if (grade7Classes[k].Enabled == true)
                    grade7Classes[k].Enabled = false;

            }

            for (k = 0; k < grade8Classes.Length; k++)
            {
                if (grade8Classes[k].Checked == true)
                    grade8Classes[k].Checked = false;
                if (grade8Classes[k].Enabled == true)
                    grade8Classes[k].Enabled = false;

            }

            for (k = 0; k < grade9Classes.Length; k++)
            {
                if (grade9Classes[k].Checked == true)
                    grade9Classes[k].Checked = false;
                if (grade9Classes[k].Enabled == true)
                    grade9Classes[k].Enabled = false;

            }

            for (k = 0; k < grade10Classes.Length; k++)
            {
                if (grade10Classes[k].Checked == true)
                    grade10Classes[k].Checked = false;
                if (grade10Classes[k].Enabled == true)
                    grade10Classes[k].Enabled = false;

            }

            for (k = 0; k < grade11Classes.Length; k++)
            {
                if (grade11Classes[k].Checked == true)
                    grade11Classes[k].Checked = false;
                if (grade11Classes[k].Enabled == true)
                    grade11Classes[k].Enabled = false;

            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string subjectTypeId, teacher_id, class_id, str, subjectName, subjectSubTypeName;
            int k, i, j = 0;

            //assign checkboxes for grades
            CheckBox[] grade6Classes = new CheckBox[10];
            grade6Classes = classes(CheckBox1, CheckBox2, CheckBox3, CheckBox4, CheckBox5, CheckBox6, CheckBox7, CheckBox8, CheckBox9, CheckBox10);
            CheckBox[] grade7Classes = new CheckBox[10];
            grade7Classes = classes(CheckBox11, CheckBox12, CheckBox13, CheckBox14, CheckBox15, CheckBox16, CheckBox17, CheckBox18, CheckBox19, CheckBox20);
            CheckBox[] grade8Classes = new CheckBox[10];
            grade8Classes = classes(CheckBox21, CheckBox22, CheckBox23, CheckBox24, CheckBox25, CheckBox26, CheckBox27, CheckBox28, CheckBox29, CheckBox30);
            CheckBox[] grade9Classes = new CheckBox[10];
            grade9Classes = classes(CheckBox31, CheckBox32, CheckBox33, CheckBox34, CheckBox35, CheckBox36, CheckBox37, CheckBox38, CheckBox39, CheckBox40);
            CheckBox[] grade10Classes = new CheckBox[10];
            grade10Classes = classes(CheckBox41, CheckBox42, CheckBox43, CheckBox44, CheckBox45, CheckBox46, CheckBox47, CheckBox48, CheckBox49, CheckBox50);
            CheckBox[] grade11Classes = new CheckBox[10];
            grade11Classes = classes(CheckBox51, CheckBox52, CheckBox53, CheckBox54, CheckBox55, CheckBox56, CheckBox57, CheckBox58, CheckBox59, CheckBox60);

            Label[] classIDList = new Label[10];
            classIDList = classIDs(Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9, Label10);

            Button[] gradeIDList = new Button[6];
            gradeIDList = gradeIDs(but_6, but_7, but_8, but_9, but_10, but_11);


            string getClassTeacher = cboTeacher.SelectedValue;
            string[] teacherDetails = getClassTeacher.Split(':');
            teacher_id = teacherDetails[0];


            subjectName = cbo_SubjectName.SelectedValue;

            subjectSubTypesCLZ subObj = new subjectSubTypesCLZ();
            subObj.setSubjectName(subjectName);

            if (subObj.noOfSubTypes(subjectName) > 1)
                subjectSubTypeName = cbo_SubjectType.SelectedValue;
            else
                subjectSubTypeName = subjectName;

            classCLZ classObj = new classCLZ();
            teacherCLZ teacherObj = new teacherCLZ();
            teacherObj.setTeacherID(teacher_id);

            subjectTypeId = subObj.getSubTypeID(subjectName, subjectSubTypeName);
            subObj.setSubjectTypeID(subjectTypeId);

            i = 0;
            for (k = 0; k < grade6Classes.Length; k++)
            {
                if ((grade6Classes[k].Checked == true))
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);
                }

                ++j;
            }

            i = 1;
            j = 0;
            for (k = 0; k < grade7Classes.Length; k++)
            {
                if (grade7Classes[k].Checked == true)
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);
                }
                ++j;
            }

            i = 2;
            j = 0;

            for (k = 0; k < grade8Classes.Length; k++)
            {
                if (grade8Classes[k].Checked == true)
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);
                }
                ++j;
            }

            i = 3;
            j = 0;

            for (k = 0; k < grade9Classes.Length; k++)
            {
                if (grade9Classes[k].Checked == true)
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);
                }
                ++j;
            }

            i = 4;
            j = 0;

            for (k = 0; k < grade10Classes.Length; k++)
            {
                if (grade10Classes[k].Checked == true)
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);

                }
                ++j;
            }

            i = 5;
            j = 0;

            for (k = 0; k < grade11Classes.Length; k++)
            {
                if (grade11Classes[k].Checked == true)
                {
                    class_id = gradeIDList[i].Text + classIDList[j].Text;
                    classObj.setClassID(class_id);
                    str = allocation(subObj, classObj, teacherObj, teacher_id);

                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", str, true);
                }
                ++j;
            }

            clearSelectedStatus();
       
        }

        protected void validateCheckBoxes(Button buton, Label label, CheckBox box)
        {
            string class_id = buton.Text + label.Text;
            string msg;
            msg = setTocheckAllocationCondition(class_id);
            int noOfSlots;
            noOfSlots = countNoOfSlots(buton.Text);
            slots = slots + noOfSlots;
            
            if (msg != null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Alert", msg, true);
                box.Checked = false;
            }
            else if (slots > 40)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Can not allocate more than 40 periods for a teacher');", true);

                box.Checked = false;
            }

        }

        //................method returns no of slots when selecting checkboxes..........................
        public int countNoOfSlots(string grade)
        {
            string subjectName, teacherID;
            int slots, slotsForTeacher;

            subjectName = cbo_SubjectName.SelectedValue;
            string getTeacher = cboTeacher.SelectedValue;
            string[] teacherDetails = getTeacher.Split(':');
            teacherID = teacherDetails[0];

            subjectSubTypesCLZ subObj = new subjectSubTypesCLZ();
            subObj.setSubjectName(subjectName);

            slots = subObj.takeNoOfSlotsForSubject(grade, subjectName);
            slotsForTeacher = new teacherCLZ().takeTotalSlots(teacherID);

            slots = slots + slotsForTeacher;
            return slots;
        }

        protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label1, CheckBox1);

        }

        protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label2, CheckBox2);

        }

        protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label3, CheckBox3);

        }

        protected void CheckBox4_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label4, CheckBox4);

        }

        protected void CheckBox5_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label5, CheckBox5);

        }

        protected void CheckBox6_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label6, CheckBox6);

        }

        protected void CheckBox7_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label7, CheckBox7);

        }

        protected void CheckBox8_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label8, CheckBox8);

        }

        protected void CheckBox9_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label9, CheckBox9);

        }

        protected void CheckBox10_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_6, Label10, CheckBox10);

        }

        protected void CheckBox11_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label1, CheckBox11);

        }

        protected void CheckBox12_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label2, CheckBox12);

        }

        protected void CheckBox13_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label3, CheckBox13);

        }

        protected void CheckBox14_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label4, CheckBox14);

        }

        protected void CheckBox15_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label5, CheckBox15);

        }

        protected void CheckBox16_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label6, CheckBox16);

        }

        protected void CheckBox17_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label7, CheckBox17);

        }

        protected void CheckBox18_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label8, CheckBox18);

        }

        protected void CheckBox19_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label9, CheckBox19);

        }

        protected void CheckBox20_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_7, Label10, CheckBox20);

        }

        protected void CheckBox21_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label1, CheckBox21);
 
        }

        protected void CheckBox22_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label2, CheckBox22);
 
        }

        protected void CheckBox23_CheckedChanged(object sender, EventArgs e)
        {

            validateCheckBoxes(but_8, Label3, CheckBox23);

        }

        protected void CheckBox24_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label4, CheckBox24);

        }

        protected void CheckBox25_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label5, CheckBox25);

        }

        protected void CheckBox26_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label6, CheckBox26);

        }

        protected void CheckBox27_CheckedChanged(object sender, EventArgs e)
        {

            validateCheckBoxes(but_8, Label7, CheckBox27);

        }

        protected void CheckBox28_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label8, CheckBox28);
   
        }

        protected void CheckBox29_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label9, CheckBox29);

        }

        protected void CheckBox30_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_8, Label10, CheckBox30);

        }

        protected void CheckBox31_CheckedChanged(object sender, EventArgs e)
        {

            validateCheckBoxes(but_9, Label1, CheckBox31);

        }

        protected void CheckBox32_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label2, CheckBox32);

        }

        protected void CheckBox33_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label3, CheckBox33);

        }

        protected void CheckBox34_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label4, CheckBox34);

        }

        protected void CheckBox35_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label5, CheckBox35);

        }

        protected void CheckBox36_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label6, CheckBox36);
 
        }

        protected void CheckBox37_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label7, CheckBox37);

        }

        protected void CheckBox38_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label8, CheckBox38);

        }

        protected void CheckBox39_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label9, CheckBox39);


        }

        protected void CheckBox40_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_9, Label10, CheckBox40);


        }

        protected void CheckBox41_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label1, CheckBox41);

        }

        protected void CheckBox42_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label2, CheckBox42);

        }

        protected void CheckBox43_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label3, CheckBox43);

        }

        protected void CheckBox44_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label4, CheckBox44);

        }

        protected void CheckBox45_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label5, CheckBox45);

        }

        protected void CheckBox46_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label6, CheckBox46);

        }

        protected void CheckBox47_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label7, CheckBox47);

        }

        protected void CheckBox48_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label8, CheckBox48);

        }

        protected void CheckBox49_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label9, CheckBox49);

        }

        protected void CheckBox50_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_10, Label10, CheckBox50);

        }

        protected void CheckBox51_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label1, CheckBox51);

        }

        protected void CheckBox52_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label2, CheckBox52);

        }

        protected void CheckBox53_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label3, CheckBox53);

        }

        protected void CheckBox54_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label4, CheckBox54);

        }

        protected void CheckBox55_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label5, CheckBox55);

        }

        protected void CheckBox56_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label6, CheckBox56);

        }

        protected void CheckBox57_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label7, CheckBox57);

        }

        protected void CheckBox58_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label8, CheckBox58);


        }

        protected void CheckBox59_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label9, CheckBox59);

        }

        protected void CheckBox60_CheckedChanged(object sender, EventArgs e)
        {
            validateCheckBoxes(but_11, Label10, CheckBox60);

        }


       
    }
}
